<?php
/**
 * Created by PhpStorm.
 * User: yui
 * Date: 2017/4/16
 * Time: 14:13
 */

namespace assets\controllers;

use Yii;
use common\controllers\AssetsCommonCtrl;
use yii\filters\VerbFilter;
use common\services\AssetsSve;

class UpController extends AssetsCommonCtrl
{
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'image' => ['post'],
                ],
            ],
        ];
    }

    public function actionIndex()
    {
        echo 'hi';
    }

    /**
     * 上传图片
     * @return array
     */
    public function actionImage()
    {
        $AssetsSve = new AssetsSve($this->TokenObj);
        $rs = $AssetsSve->uploadImage();
        return $rs;
    }

    /**
     * 上传视频
     */
    public function actionVideo()
    {
        $AssetsSve = new AssetsSve($this->TokenObj);
        return $AssetsSve->uploadVideo();
    }
}